
use health/test_daily_panel, clear
sum date
local poprate = _N/(6.62e6 * (r(max)-r(min)))
di `poprate'
use health/test_hospitalized_panel, clear


forvalues ds = 1/61 {
	gen test`ds' = time_since == `ds' - 31
}

gen count = 1
collapse (sum) test1-test61 count, by(no_dx any_icli)

reshape long test, i(no_dx any_icli) j(ttime)
gen time_since = ttime - 31
rename test ntests


gen test_rate = ntests/count

# delimit ; 
twoway
	(connected  test_rate time_since if no_dx==0 & any_icli == 0,
		color(maroon) )
	,
	xlabel(-30 -14 -7 0 7 14 30)
	xtitle("Days relative to admission") ytitle("") ylabel(0(.025).075)
	xline(0, lcolor(gs8) lwidth(thin))
	graphregion(color(white))
;
# delimit cr
graph export figures/hospital_test_times.pdf, replace 
